﻿#ifndef INTERCOM_H
#define INTERCOM_H

#include <QObject>
#include <QTcpServer>
#include <QTcpSocket>
#include <QMap>
#include "oeasycommon.h"
#include "configfile.h"
#include "commonfuc.h"
#include <QTimer>

class Intercom : public QObject
{
    Q_OBJECT
public:
    explicit Intercom(int port, QObject *parent = 0);

private:
    QTcpServer m_server;
    QMap<QTcpSocket *, QString> m_cliMap;
    ConfigFile m_cfg;

signals:
    void textRecv(QString);
    void sigOpenDoor(QByteArray,QString);
public slots:
    void onNewConnection();
    void onClose(QAbstractSocket::SocketError);
    void onRead();
    void onFaceOpenDoor(QString mac, QString userid);
};

#endif // INTERCOM_H
